package com.xcdh.ittools.controller;

import com.api.ittools.entity.ToolDict;
import com.api.ittools.entity.ToolDictItem;
import com.xcdh.commons.controller.BaseController;
import com.xcdh.domain.vo.R;
import com.xcdh.ittools.service.ToolDictItemService;
import com.xcdh.ittools.service.ToolDictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/toolDictItem")
public class ToolDictItemController extends BaseController<ToolDictItem , ToolDictItemService> {

    @Autowired
    private ToolDictService toolDictService ;
    @Autowired
    private ToolDictItemService dictItemService ;

    @PostMapping("/dictList/{key}")
    public R<List<ToolDictItem>> dictList(@PathVariable String key){
        List<ToolDictItem> list = dictItemService
                .lambdaQuery()
                .eq(ToolDictItem::getDictType, key).list();
        return R.okData(list) ;
    }
}
